home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
047a
/
probots.arj
/
MECHANIC.PR
< prev
next >
Wrap
Text File
|
1988-11-05
|
2KB
|
61 lines
PROCEDURE Mechanic;
{ Based on a C-Robot By Bruce Oberleitner }
{ Sometimes, simplicity is best. This robot has absolutely }
{ no defense whatsoever!! It quickly locks onto a target }
{ and chases it around the playfield. It relies on the target }
{ going into a defensive mode while it stays on the ofensive. }
{ If the target is destroyed or it moves out of the scan area, }
{ a new target is selected and fired upon. }
VAR Range : Integer;
Angle : Integer;
PROCEDURE med_scan(scan_angle : Integer);
{ within 10 degrees of original scan angle }
VAR temp_angle : Integer;
res : Integer;
Inc : Integer;
BEGIN
temp_angle := scan_angle-5;
WHILE (temp_angle <= (scan_angle+30)) DO
BEGIN
Range := scan(temp_angle, 5); { scan 10 degree section }
drive(temp_angle, 50);
IF (Range <> 0) THEN
cannon(temp_angle, Range);
IF (Range = 0) THEN
temp_angle := temp_angle+5;
END; { while }
END; { end of med_scan }
PROCEDURE corse_scan(scan_angle : Integer);
BEGIN
WHILE True DO {Loop Forever}
BEGIN
Range := scan(scan_angle, 10);
IF (Range <> 0) THEN
BEGIN
cannon(scan_angle, Range); { take a real potshot }
drive(scan_angle, 50);
med_scan(scan_angle);
END;
scan_angle := scan_angle+20;
END;
END; { end of corse sub-program }
BEGIN {Mechanic Main}
Angle := Random(360);
corse_scan(Angle);
END; {end of Mechanic Main program }